package com.itwn.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itwn.entity.Score;
import com.itwn.mapper.ManagerMapper;
import com.itwn.mapper.ScoreMapper;
import com.itwn.vo.CommentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CommentService {
    @Autowired
   ScoreMapper scoreMapper;



    public PageInfo<CommentVo> showAllComments(Integer pageSize,Integer pageNum,String inputByUser,String select) {
        PageHelper.startPage(pageNum,pageSize);
        List<CommentVo> list = new ArrayList<>();
        if(select.equals("1")){
            list = scoreMapper.selectAllByComment(inputByUser);
        }else if(select.equals("2")){
            list = scoreMapper.selectAllByMovieName(inputByUser);
        }else if(select.equals("3")){
            list = scoreMapper.selectAllByUser(inputByUser);
        }else if(select.equals("0")){
            list = scoreMapper.selectAll();
        } else if(select.equals("4")){
            list = scoreMapper.selectAllByAnyCons(inputByUser);
        }

        return new PageInfo<>(list);

    }

    public void deleteComment(Integer socreId) {
     scoreMapper.deleteComment(socreId);

        }





}
